package top.easyblog.core.support.bloom;

import org.redisson.api.RBloomFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: frank.huang
 * @date: 2023-12-24 18:56
 */
@Component
public class RedissonBloomFilterSupport {

    @Autowired
    private RBloomFilter<String> rBloomFilter;


    /**
     * 添加数据到Bloom Filter
     *
     * @param code
     * @return
     */
    public boolean add(String code) {
        return rBloomFilter.add(code);
    }


    /**
     * 判断key是否存在
     *
     * @param code
     * @return
     */
    public boolean contains(String code) {
        return rBloomFilter.contains(code);
    }


}
